

const path = require('path');
const staticImg = path.join(__dirname, 'static');

function SensorbitUnoBlocks(Blockly) {
    var color_sensor = "#28BFE6";




    //避障传感器数字值
    Blockly.Blocks.microbit_AvoidanceDigital = {
        init:function(){
        this.setColour(color_sensor);
        this.appendDummyInput("")
            .appendField(new Blockly.FieldImage(staticImg+"/avoidance sensor.svg", 84, 42))
            .appendField(Blockly.Msg.MICROBIT_AVOIDANCE)
            .appendField(new Blockly.FieldDropdown([
                ['P0', "pin0"],
                ['P1', "pin1"],
                ['P2', "pin2"],
                ['P3', "pin3"],
                ['P4', "pin4"],
                ['P5', "pin5"],
                ['P6', "pin6"],
                ['P7', "pin7"],
                ['P8', "pin8"],
                ['P9', "pin9"],
                ['P10', "pin10"],
                ['P11', "pin11"],
                ['P12', "pin12"],
                ['P13', "pin13"],
                ['P14', "pin14"],
                ['P15', "pin15"],
                ['P16', "pin16"],
                ['P17', "pin17"],
                ['P18', "pin18"],
                ['P19', "pin19"],
                ['P20', "pin20"],
                // ['P8', "pin8"],
                // ['P13', "pin13"],
                // ['P15', "pin15"],
            ]),"avoidanceDigital")
            .appendField(Blockly.Msg.MICROBIT_AVOIDANCEDIGITAL)
            this.setOutputShape(Blockly.OUTPUT_SHAPE_HEXAGONAL);
            this.setOutput(true, 'Boolean');
            this.setTooltip('');
        }
    };

    return Blockly;
}

module.exports = SensorbitUnoBlocks;

